package com.kompas.bola.application.adapter;

import java.util.List;
import com.kompas.bola.application.R;
import com.kompas.bola.application.model.Content;
import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class ListTopskorAdapter extends BaseAdapter{
	/** =========================================================================== */   
	private Activity activity;
	private List<Content> data;
	private static LayoutInflater inflater = null;
	/** =========================================================================== */   
	public ListTopskorAdapter(Activity a, List<Content> d) {
		activity 					= a;
		data 						= d;
		inflater 					= (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    }
	/** =========================================================================== */   
	public int getCount() {
		return data.size();
	}
	/** =========================================================================== */   
	public Object getItem(int position) {
		return position;
	}
	/** =========================================================================== */   
	public long getItemId(int position) {
		return position;
	}
	/** =========================================================================== */   
	public View getView(int position, View convertView, ViewGroup parent) {
		View vi 					= convertView;

		vi = inflater.inflate(R.layout.list_topskor, null);	
		
		if (position % 2 == 0){		
			vi = inflater.inflate(R.layout.list_topskor_next, null);			
		}
		
		TextView gol				= (TextView) vi.findViewById(R.id.gol); // gol
		TextView pemain				= (TextView) vi.findViewById(R.id.pemain); // pemain
        
        Content bola				= new Content();
        bola 						= data.get(position);

        gol.setText(bola.getKEY_GOL());
        pemain.setText(bola.getKEY_PLAYER());
		
		return vi;
	}
	/** =========================================================================== */   


}
